import Vue from 'vue'
import Vuex from 'vuex'
import mutations from './mutations'
import actions from './actions'
import getters from './getters'
import VuexPersistence from 'vuex-persist' //持久化插件


const vuexLocal = new VuexPersistence({
  storage: window.localStorage
})
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    city: '北京', //当前城市
    id: 0, //当前城市ID
    geohash: '0', //经纬度
    latitude: 0,
    longitude: 0,
    isLogin: false, //是否登录
    user: {}, //用户信息
    car: [], //购物车
    search: [] //历史记录
  },
  getters,
  actions,
  mutations,
  plugins: [vuexLocal.plugin]
})
